package com.zhou.cloud.service.impl;

import com.zhou.cloud.dao.entity.SqlUuid;
import com.zhou.cloud.dao.mapper.SqlUuidMapper;
import com.zhou.cloud.service.IGeneratorUuidService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.test.context.jdbc.Sql;

/**
 * @descrition: mysql实现uuid生成
 * @author: zhouyongjun
 * @date: 2022/10/28
 **/
@Service("mysqlUuidService")
@Slf4j
public class MysqlGeneratorUuidServiceImpl implements IGeneratorUuidService {
    @Autowired
    SqlUuidMapper uuidMapper;
    @Override
    public Long generatorUuid() {
        SqlUuid record = new SqlUuid();
        uuidMapper.insert(record);
        log.warn("generatorUuid uuid = {} ",record.getId());
        return record.getId();
    }
}


